package com.bupt.utils;

import com.bupt.exception.BaseException;
import org.apache.commons.lang3.StringUtils;

public class LocalVerify {

    //检验是否为null
    public static void verifyStringIsNotNull(String... strs) throws BaseException {
        if (null != strs && strs.length > 0) {
            for (String str : strs) {
                if (StringUtils.isEmpty(str)) {
                    throw new BaseException("请求的参数存在空值");
                }
            }
        }
    }

    public static void verifyString(String str, String message) throws BaseException {
        if (StringUtils.isEmpty(str)) {
            throw new BaseException(message + " 不能为空 ");
        }
    }

    public static void verifyObject(Object o, String message) throws BaseException {
        if (null == o) {
            throw new BaseException(message + " is null ");
        }
    }

}
